package com.tangl.demo.confirmation;

import org.springframework.util.StringUtils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author: TangLiang
 * @date: 2020/8/6 16:50
 * @since: 1.0
 */
public class CheckMessageFactory {
    private static Map<String, CheckMessageHandler> checkmessageMap = new ConcurrentHashMap<>();

    public static CheckMessageHandler getInvokeStrategy(String name) {
        return checkmessageMap.get(name);
    }

    public static void register(String name, CheckMessageHandler handler) {
        if (StringUtils.isEmpty(name) || null == handler) {
            return;
        }
        checkmessageMap.put(name, handler);
    }
}
